import React, {Component} from 'react'
import {
    View,
    Image,
    Text,
    StyleSheet,
    TouchableHighlight,
    TouchableOpacity
} from 'react-native'
import TitleBar from "../common/TitleBar";

export default class MyPage extends Component {

    static defaultProps = {
        key: '姓名'
    }

    constructor(props) {
        super(props)
        this.state = {
            customThemeViewVisible: false,
            theme: this.props.theme
        }
    }

    callback(params) {
        if (!this.props.navigation.state.params.callback) {
            this.props.navigation.state.params.onGoBack(params);
            this.props.navigation.goBack();
        }
    }

    render() {

        return (

            <View style={styles.container}>
                <TitleBar
                    title="MyPage"
                />

                <TouchableOpacity
                    onPress={()=>{
                        // alert("sdf")
                        this.callback("返回值:哈哈哈")
                    }}
                >
                    <View style={{height: 200, backgroundColor: 'red'}}>

                        <Text>
                            {this.props.navigation.state.params.key}
                        </Text>
                    </View>
                </TouchableOpacity>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    }
})